<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
    <title>我的</title>
    <link rel="stylesheet" type="text/css" href="../../css/api.css" />
    <link rel="stylesheet" type="text/css" href="../../css/aui.css" />
    <link rel="stylesheet" type="text/css" href="../../css/public.css">
    <link rel="stylesheet" type="text/css" href="../../css/data-flex.min.css">
    <style>
    </style>
</head>

<body>
    <div class="vueApp" v-cloak>
        
    </div>
</body>
<script type="text/javascript" src="../../script/api.js"></script>
<script type="text/javascript" src="../../script/service/service-tool.js"></script>
<script type="text/javascript" src="../../script/service/service-app.js"></script>
<script type="text/javascript" src="../../script/service/service-user.js"></script>
<script type="text/javascript" src="../../script/service/service-logic.js"></script>
<script type="text/javascript" src="../../script/vue.min.js"></script>
<script type="text/javascript">
    var $S, USER;
    var vm;
    apiready = function() {
        $S = SERVICE();
        USER = USER();
        fnInit();
        localStorage.safeTop = api.safeArea.top; //获取顶部状态栏的高度
        localStorage.safeBottom = api.safeArea.bottom; //获取底部栏的高度
        fixStatusBar();
        setTimeout(function() {
            fnSetPlayFrmFront();
        }, 300);

        if (vm.custId != '') {
            fnInitPage();
        } else {
            vm.isLoad = true;
        }
        api.addEventListener({
            name: 'loginStatus'
        }, function(ret, err) {
            vm.custId = USER.Get("custId", true) || "";
            if (ret.value.login) {
                fnInitPage();
            } else {
                vm.userInfo = "";
            }
        });

    }

    function fnInit() {
        vm = new Vue({
            el: ".vueApp",
            data: {
                custId: USER.Get("custId", true) || "",
                userInfo: "",
                isLoad: false,
            },
            methods: {

            }
        })
    }

    function fnInitPage() {
        if(fnCheckIsOpenLogin()){
            $S.ShowProgress();
            $S.POST("apiTbAppUser/findUserBasic", "", function(ret, err) {
                if (ret && ret.status == '200') {
                    vm.userInfo = ret.data;
                    api.execScript({
                        name: 'main',
                        frameName: 'tab_index',
                        script: 'fnInitPage();'
                    });
                    api.execScript({
                        name: 'main',
                        frameName: 'tab_course',
                        script: 'fnInitPage();'
                    });
                }
                $S.CloseProgress();
                vm.isLoad = true;
            })
        }
    }
</script>

</html>
